home *** CD-ROM | disk | FTP | other *** search
/ Software 2000 / Software 2000 Volume 1 (Disc 1 of 2).iso / utilities / u264.dms / in.adf / ARPPRO3.0 / PRO.RUN / wbparse.c < prev   
Encoding:
C/C++ Source or Header  |  1992-04-18  |  1.6 KB  |  59 lines

  1. /* Copyright (C) 1986,1987 by Manx Software Systems, Inc. */
  2.  
  3. /*
  4.  *    This routine is called from the _main() routine and is used to
  5.  *    open a window for standard I/O to use. The window is actually
  6.  *    defined by setting the ToolType, "WINDOW", to the desired window
  7.  *    specification. If this is not required, this routine may be
  8.  *    replaced by a stub in the users main program. Note that even if
  9.  *    this code is called by _main(), if the WINDOW tool type is not
  10.  *    defined, there will be no window.
  11.  *
  12.  *    EXAMPLE:    WINDOW=CON:0/0/640/200/Test Window
  13.  */
  14.  
  15. /* tweeked to handle v1.4 wbench startup */
  16.  
  17. #include <libraries/dosextens.h>
  18. #include <workbench/workbench.h>
  19. #include <workbench/startup.h>
  20. #include <workbench/icon.h>
  21.  
  22. #include <fcntl.h>
  23.  
  24. void *IconBase;
  25.  
  26. _wb_parse(pp, wbm)
  27. register struct Process *pp;
  28. struct WBStartup *wbm;
  29. {
  30.     register char *cp;
  31.     register struct DiskObject *dop;
  32.     register struct FileHandle *fhp;
  33.     register long wind;
  34.     void *_OpenLibrary();
  35.     long _Open();
  36.  
  37.     if ((IconBase = _OpenLibrary("icon.library", 0L)) == 0)
  38.         return;
  39.     if ((dop = GetDiskObject(wbm->sm_ArgList->wa_Name)) == 0)
  40.         goto closeit;
  41.     if (cp = FindToolType(dop->do_ToolTypes, "WINDOW")) {
  42.         if (wind = _Open(cp, MODE_OLDFILE)) {
  43.             fhp = (struct FileHandle *) (wind << 2);
  44.             pp->pr_ConsoleTask = (APTR) fhp->fh_Type;
  45.             pp->pr_CIS = (BPTR)wind;
  46.             pp->pr_COS = (BPTR)_Open("*", MODE_OLDFILE);
  47.              /* !!! 1.4 tweek */
  48.             _devtab[0].mode &= ~O_STDIO;    /* setup for exit to close these if we succeeded */
  49.             _devtab[1].mode &= ~O_STDIO;
  50.              /* !!! 1.4 tweek */
  51.         }
  52.     }
  53.     FreeDiskObject(dop);
  54. closeit:
  55.     CloseLibrary(IconBase);
  56.     IconBase = 0;
  57. }
  58.  
  59.